SDK-2781: Python - Add support for new capture_type property on Static Liveness resources - python#460
Conversation
Sdk 2267 python update dependencies
Sdk 2267 python update dependencies
Release/2.14.2
Python library updates
* SDK-2648 updated version of protobuf * Update version to 2.14.4 * SDK-2648: Update protobuf to 4.21.12+ * Remove accidentally committed virtual environment files from Flask example * Update doc_scan example requirements for protobuf 4.21.12 and SDK v2.14.4 * Update Flask example requirements for protobuf 4.21.12 and SDK v2.14.4 * updated versions in examples * Fix GitHub Actions workflow to install local SDK before example requirements
* Python library updates * added python static liveness check (#425) * update version files
… Static Liveness resources [python]
🤖 Claude Code ReviewCode Review FindingsCriticalNone MajorNone Minor
Nit
|
|
There was a problem hiding this comment.
Pull request overview
Adds support for the Doc Scan API’s new capture_type field on Static Liveness resources by parsing it into StaticLivenessResourceResponse and exposing it via a new capture_type property, with None as the default when absent.
Changes:
- Parse and store
capture_typeinStaticLivenessResourceResponseand expose it via a new@property. - Extend unit tests for static liveness parsing to cover present/missing
capture_typeandNonepayload input. - Add a
ResourceContainertest ensuringcapture_typeis available for static liveness resources and not present on zoom liveness resources.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.py | Parses capture_type from API payload and exposes it as a property on static liveness resources. |
| yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py | Adds/updates tests covering capture_type parsing and edge cases (missing field, None data). |
| yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.py | Verifies capture_type is surfaced via ResourceContainer.static_liveness_resources and absent on zoom resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
* added python static liveness check (#425) * update version files * updated protobuf error * Sdk 2758 python add support for requesting and retrieving share code resources tasks (#462) * SDK-2758-python-add-support-for-requesting-and-retrieving-share-code-resources-tasks * Fix Copilot review issues and rebase onto development * Fix remaining is comparison for BASIC auth type in test * SDK-2792: Python - Add support for retrieving the extraction_image_ids field from the IDV pages - python (#461) * feat(SDK-2792): Python - Add support for retrieving the extraction_image_ids field from the IDV pages [python] Rebase onto development to resolve conflicts. * SDK-2781: Python - Add support for new capture_type property on Static Liveness resources - python (#460) * feat(SDK-2781): Python - Add support for new capture_type property on Static Liveness resources [python] * SDK-2614: Python - Support configuration for IDV shortened flow - python (#459) * feat(SDK-2614): Python - Support configuration for IDV shortened flow [python] * fix(SDK-2614): address Copilot review comments on sdk_config * SDK-2473: Python - IDV Support Brand ID in session config - python (#458) * SDK-2743-python-expose-idv-breakdown-process-property (#453) * SDK-2743-python-expose-idv-breakdown-process-property * SDK-2792-python-add-support-for-retrieving-the-extraction-image-ids-f… (#452) * SDK-2792-python-add-support-for-retrieving-the-extraction-image-ids-field-from-the-idv-pages * Sdk 2803 python upgrade dependencies to address security cv es core sdk examples (#463) * SDK-2803 Phase 1: bump core SDK dependencies to close High-severity CVEs * SDK-2803 Phase 2: bump protobuf to >=4.25.8,<6 and regenerate pb2 modules * SDK-2803 Phase 3: upgrade example apps to close shipped CVEs * update sonarqube problems * Fix remaining SonarQube findings and backports.zoneinfo CI failure * Suppress SonarQube pip security findings with NOSONAR comments



Summary
Adds support for the new
capture_typeproperty on Static Liveness resources returned by the Doc Scan API. TheStaticLivenessResourceResponseclass now exposes acapture_typeattribute (e.g."PHOTOGRAPH") parsed from the API response, defaulting toNonewhen the field is absent.Changes
yoti_python_sdk/doc_scan/session/retrieve/static_liveness_resource_response.pycapture_typefrom the response payload in__init__usingdata.get("capture_type", None).capture_type@propertyexposing the value (returnsstrorNone).yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.pycapture_type == "PHOTOGRAPH".capture_type is Nonein the existing missing-image test.test_should_handle_missing_capture_typeandtest_should_handle_none_datato cover absent/empty payloads.yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.pytest_should_expose_capture_type_on_static_liveness_resourceverifying thatcapture_typeis wired throughResourceContainer.static_liveness_resourcesand is not present on non-static (Zoom) liveness resources.QA Test Steps
websdk-auto/SDK-2781-python-python---add-support-for-new-capture-type-property-on-static-liveness-resources.pip install -e .andpip install -r requirements.txt(or your usual install command).pytest yoti_python_sdk/tests/doc_scan/session/retrieve/test_static_liveness_resource.py -vpytest yoti_python_sdk/tests/doc_scan/session/retrieve/test_resource_container.py -vtest_should_parse_static_liveness_resource_response(assertscapture_type == "PHOTOGRAPH").test_should_handle_missing_capture_typeandtest_should_handle_none_data.test_should_expose_capture_type_on_static_liveness_resource.pytest yoti_python_sdk/tests/doc_scan/ -vStaticLivenessResourceResponse({"id": "x", "liveness_type": "STATIC"}).capture_typemust beNone.StaticLivenessResourceResponse(None).capture_typemust beNone(and.imagemust beNone).ResourceContainerwith aliveness_capturearray containing oneSTATICentry withcapture_typeand oneZOOMentry; confirmstatic_liveness_resources[0].capture_typereturns the expected value and the Zoom resource has nocapture_typeattribute.StaticLivenessResourceResponsefields (id,liveness_type,image,image.media.id) still parse correctly whencapture_typeis both present and absent.Notes
capture_typeis exposed as a plain string (e.g."PHOTOGRAPH") rather than an enum, mirroring how other backend-driven string fields (liveness_type, sourcetype, etc.) are handled in this SDK. If a canonical set of values is later defined, an enum could be added in a follow-up without breaking the public API.Nonewhen missing, preserving backwards compatibility with older API responses that do not includecapture_type.StaticLivenessResourceResponseis updated; other liveness resource types (e.g. Zoom) are intentionally untouched per the ticket scope.Related Jira: SDK-2781
Auto-generated by n8n + Claude CLI